import request from '@/utils/request'
/**
 * 获取部门列表数据接口方法
 */
export const getDepartmentsAPI = () => {
  return request('/company/department')
}

/**
 * 获取部门负责人列表接口
 */
export const getManagesAPI = () => {
  return request('/sys/user/simple')
}

/**
 * 新增子部门接口
 * @param {object} data
 */
export const addDepartmentAPI = (data) => {
  return request.post('/company/department', data)
}

/**
 * 获取部门详情
 * @param {number} id 部门id
 */
export const getDepartmentDetailAPI = (id) => {
  return request(`/company/department/${id}`)
}

/**
 * 修改部门数据
 * @param {object} data 修改后的部门表单数据
 */
export const updateDepartmentAPI = (data) => {
  return request.put(`/company/department/${data.id}`, data)
}

/**
 * 删除部门
 * @param {*} id 部门id
 */
export const delDepartmentAPI = (id) => {
  return request.delete(`/company/department/${id}`)
}
